package cn.itsource.util;

import org.springframework.core.convert.converter.Converter;

import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;

public class UTCDateConverter implements Converter<Date, Date> {
    @Override
    public Date convert(Date source) {
        TimeZone timeZone = TimeZone.getTimeZone("Asia/Shanghai");
        Calendar calendar = Calendar.getInstance(timeZone);
        calendar.setTime(source);
        return calendar.getTime();
    }
}